#include <stdio.h>
#include <sys/types.h>
#include <sys/shm.h>
#include <sys/ipc.h>

int main()
{
	key_t key = ftok(".",101);
	if(key == -1)
		perror("ftok") , exit(-1);
	int shmid = shmget(key,0,0);
	if(shmid == -1)
		perror("shmget") , exit(-1);
	void *p = shmat(shmid,0,0);
	if(p == (void *) -1)
	        perror("shmat") , exit(-1);
	int *p1 = p ;
	printf("shmat value : %d\n",*p1);
}
